<?php echo $this->render('header.phtml'); ?>
<link type="text/css" rel="stylesheet" href="/public/js_calendar/dhtmlgoodies_calendar.css" media="screen"></LINK>
<script type="text/javascript" src="/public/js_calendar/dhtmlgoodies_calendar.js"></script>
<h2><?php echo $this->escape($this->content_title);?>
<a style="float:right" target="_blank" href="/realty/excel<?php echo $this->path;?>"><img src="/public/images/excel.png"/></a>
</h2>

<?php /*
<font style="float:right;padding-bottom:5px;">
$languages = explode(',',LANGUAGES);
foreach($languages as $l) {
    echo '<a href="/article/index/lang/'.$l.'" title="'.ucfirst($l).'"><img src="/public/images/lang/'.$l.'.png" style="margin:3px;border: solid '.
    ($this->language==$l?'2px red':'1px #E7E7E7').';"/></a>';
}
</font> */ 
$link = '/realty/edit/id/';
$deletelink = '/realty/delete/id/';

?>
<form>
<table border="0" cellpadding="3">
<tr>

<td> C </td> <td> <input type="text" size="10" id="from_date" name="from_date" value="<?php echo $this->escape(trim($this->item->from_date));?>"> </td>
<td width="70"> <img id="today_trigger" src="/public/images/cal.gif" style="padding:6px;" onclick="displayCalendar(document.getElementById('from_date'),'yyyy-mm-dd',this);"> </td>


<td> По </td> <td> <input type="text" size="10" id="to_date" name="to_date" value="<?php echo $this->escape(trim($this->item->to_date));?>"> </td>
<td width="70"> <img id="today_trigger" src="/public/images/cal.gif" style="padding:6px;" onclick="displayCalendar(document.getElementById('to_date'),'yyyy-mm-dd',this);"> </td>

<td> Комнат </td> <td> <input type="text" size="10" id="flats" name="flats" value="<?php echo $this->escape(trim($this->item->flats));?>"> </td>

</tr>
<tr>

<td> Город </td> <td colspan="2">
<select id="city" name="city" size="1">
    <option value="">Все</option>
    <?php foreach($this->citys as $key=>$value) { ?> 
    <option value="<?php echo $key;?>" <?php echo $this->escape(trim($this->item->city))==$key?' selected ':'';?>><?php echo $value;?></option>
    <?php } ?>
</select>
</td>

<td> Мкр/Улица </td> <td> <input type="text" size="10" id="street" name="street" value="<?php echo $this->escape(trim($this->item->street));?>"> </td> <td></td>




<td> Тип Дома </td> <td>
<select id="type" name="type" size="1">
    <option value="">Все</option>
    <?php foreach($this->types as $key=>$value) { ?> 
    <option value="<?php echo $key;?>" <?php echo $this->escape(trim($this->item->type))==$key?' selected ':'';?>><?php echo $value;?></option>
    <?php } ?>
</select>
</td>
</tr>

<tr><td colspan="8" align="right">
<a href="javascript:document.forms[0].submit();" class="bt_blue"><span class="bt_blue_lft"></span><strong>Искать</strong><span class="bt_blue_r"></span></a>
</td></tr>
<table>

</form>
<table summary="Недвижимость" id="rounded-corner">
    <thead>
        <tr>
            <th class="rounded-company" scope="col"></th>
            <th class="rounded" scope="col">Дата</th>
            <th class="rounded" scope="col">Адрес</th>
            <th class="rounded" scope="col" title="Количество комнат">Ком.</th>
            <th class="rounded" scope="col" title="Этаж/Этажность">Эт/Эт</th>
            <th class="rounded" scope="col">Тип</th>
            <th class="rounded" scope="col">Площадь (кв.м.)</th>
            <th class="rounded" scope="col">Цена (тенге)</th>
            <th class="rounded" scope="col">Тенге/кв.метр </th>
            <?php if($this->can_delete) { ?>
            <th class="rounded-q4" scope="col">Delete</th>
            <?php } ?>
        </tr>
    </thead>
    <!--<tfoot>
        <tr>
            <td class="rounded-foot-left" colspan="6"><em>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut.</em></td>
            <td class="rounded-foot-right">&nbsp;</td>

        </tr>
    </tfoot>-->
    <tbody>
<?php foreach($this->items as $obj) : ?>
        <tr>
            <td><input type="checkbox" name=""></td>
            <?php if($this->can_edit) { ?>
            <td><a href="<?php echo $link.$obj->id ?>"><?php echo $this->escape($obj->today);?></a></td>
            <td><a href="<?php echo $link.$obj->id ?>"><?php echo $this->escape($this->citys[$obj->city].', '.$this->escape($obj->street).' , д.'.$this->escape($obj->house));?></a></td>
            <?php } else { ?>
            <td><?php echo $this->escape($obj->today);?></td>
            <td><?php echo $this->escape($this->citys[$obj->city].', '.$this->escape($obj->street).' , д.'.$this->escape($obj->house));?></td>
            <?php } ?>
            <td><?php echo $this->escape($obj->flats);?></td>
            <td><?php echo $this->escape($obj->floor).'/'.$this->escape($obj->floors);?></td>
            <td><?php echo $this->escape($this->types[$obj->type]);?></td>
            <td><?php echo $this->escape($obj->square).' кв.м.';?></td>
            <td><?php echo $this->escape($obj->price).' тенге';?></td>
            <td><?php echo $this->escape(number_format($obj->square>0?$obj->price/$obj->square:0,2));?></td>
            <?php if($this->can_delete) { ?>
            <td><a class="ask" href="<?php echo $deletelink.$obj->id ?>"><img border="0" title="" alt="" src="/public/images/trash.png"></a></td>
            <?php } ?>
        </tr>
<?php endforeach; ?>
               
    </tbody>
</table>
<a class="bt_green" href="/realty/add"><span class="bt_green_lft"></span><strong>Добавить</strong><span class="bt_green_r"></span></a>
<?php /* if($this->can_delete) { ?>
<a class="ask bt_red" href="/article/delete"><span class="bt_red_lft"></span><strong>Delete items</strong><span class="bt_red_r"></span></a>
<?php } */ ?>
<?php echo $this->render('footer.phtml'); ?>
